﻿Public Class RtpoConstruccion

    Public Shared Function SeleccionarTodo(ByVal descEmpresa As String, ByVal DisplaySelect As Boolean) As List(Of EtpoConstruccion)
        Dim tpoConstrucciones As List(Of EtpoConstruccion) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                tpoConstrucciones = DTpoConstruccion.SeleccionarTodo(descEmpresa)
                If tpoConstrucciones Is Nothing Then tpoConstrucciones = New List(Of EtpoConstruccion)
                If DisplaySelect Then tpoConstrucciones.Insert(0, New EtpoConstruccion("00", "-- SELECCIONAR --"))
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return tpoConstrucciones
    End Function
    Public Shared Function SeleccionarXEstado(ByVal descEmpresa As String, ByVal DisplaySelect As Boolean) As List(Of EtpoConstruccion)
        Dim contruccions As List(Of EtpoConstruccion) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                contruccions = DTpoConstruccion.SeleccionarTodoxEstado(descEmpresa)
                If contruccions Is Nothing Then contruccions = New List(Of EtpoConstruccion)
                If DisplaySelect Then contruccions.Insert(0, New EtpoConstruccion("00", "-- SELECCIONAR --"))
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return contruccions
    End Function
    Public Shared Function Añadir(ByVal descEmpresa As String, ByVal pTpoConstruccion As EtpoConstruccion) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DTpoConstruccion.Añadir(descEmpresa, pTpoConstruccion)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function
    Public Shared Function Editar(ByVal descEmpresa As String, ByVal pTpoConstruccion As EtpoConstruccion) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DTpoConstruccion.Editar(descEmpresa, pTpoConstruccion)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function
    Public Shared Function Eliminar(ByVal descEmpresa As String, ByVal pTpoConstruccion As EtpoConstruccion) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DTpoConstruccion.Eliminar(descEmpresa, pTpoConstruccion)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function

End Class
